package y23.Dec;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Test5 {
    public static void main(String[] args) {
        List<Card> list = new CardList().buyCards();
        shuffle(list);
        System.out.println(list);

    }
    public static void shuffle(List<Card> list){
        for (int i = 0; i < list.size()*2; i++) {
            Random r1 = new Random();
            Random r2 = new Random();
            int rd1 = r1.nextInt(list.size()-1);
            int rd2 = r2.nextInt(list.size()-1);
            Card t = list.get(rd1);
            list.set(rd1,list.get(rd2));
            list.set(rd2,t);
        }
    }

}
class Card{
    private String suits;
    private int card;
    public Card(String suits, int card) {
        this.suits = suits;
        this.card = card;
    }

    public String getSuits() {
        return suits;
    }

    public void setSuits(String suits) {
        this.suits = suits;
    }

    public int getCard() {
        return card;
    }

    public void setCard(int card) {
        this.card = card;
    }

    @Override
    public String toString() {
        return card + suits;
    }
}
class CardList{
    private static final String[] SUITS ={"♦","♠","♥","♣"};

    public List<Card> buyCards(){
        List<Card> list = new ArrayList<>();
        for (int i = 0; i < 13; i++) {
            for (int j = 0; j < SUITS.length; j++) {
                Card card = new Card(SUITS[j],i+1);
                list.add(card);
            }
        }
        return list;
    }
}
